package com.practice.controller;/**
 * Created by mayn on 2019/9/25.
 */

import com.practice.bean.User;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName
 * @Description TODO
 * @Author mayn
 * @Date
 * @Version 1.0
 */
@Api("用户管理")
@RestController
@RequestMapping("/user")
public class UserController {

    @ApiOperation("根据ID获取用户信息")
    @ApiImplicitParams({@ApiImplicitParam(paramType = "query",name = "id",dataType = "int",required = true,value = "用户的ID",defaultValue = "1")})
    @ApiResponses({@ApiResponse(code=400,message = "请求参数异常"),
                   @ApiResponse(code = 404,message = "请求路径异常")
    })
    @RequestMapping(value="/getUserInfo",method = RequestMethod.GET)
    public User getUserInfoById(@RequestParam("id") int id){
        if(id==1){
            return new User(1,"小明",18,"男","深圳市龙岗区天安云谷AI创新中心","420115199305052873","13871007341");
        }
        return new User(2,"小豪",27,"男","深圳市龙岗区雪象新村","420115199305052872","13871007341");

    }
}
